package binary_tree.LeetCode;

public class Num897 {
    TreeNode t;
    public TreeNode increasingBST(TreeNode root) {
        TreeNode ans=new TreeNode(-1);
        t=ans;
        formTree(root);
        return ans.right;
}

    private void formTree(TreeNode root) {
        if(root==null){
            return;
        }
        formTree(root.left);
        t.right=new TreeNode(root.val);
        t=t.right;
        formTree(root.right);

    }

}
